package com.rjwh.dingdong.client.mvp.model.impl;

import com.aishua.lib.task.AsResult;
import com.rjwh.dingdong.client.constant.NetConstant;
import com.rjwh.dingdong.client.mvp.BaseModel;
import com.rjwh.dingdong.client.mvp.BasePresenter;
import com.rjwh.dingdong.client.mvp.model.IRadioAnchorListModel;
import com.rjwh.dingdong.client.network.HttpWebService;
import com.rjwh.dingdong.client.network.HttpWebServiceCallBack;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Kay
 * @ClassName RadioAnchorListModel
 * @Description
 * @date 2016-11-17
 * @history 2016-11-17 author: description:
 */

public class RadioAnchorListModel extends BaseModel implements IRadioAnchorListModel, HttpWebServiceCallBack {

    public RadioAnchorListModel(BasePresenter basePresenter) {
        super(basePresenter);
    }

    /**
     * 获取主播列表(主播电台、创客频道)
     *
     * @param category  分类owner|creater
     * @param pageindex 页数
     * @param isRefresh
     */
    @Override
    public void doGetRadioList(String category, int pageindex, boolean isRefresh) {
        Map<String, String> params = new HashMap<>();
        params.put("category", category);
        params.put("pageindex", String.valueOf(pageindex));
        HttpWebService.getDataFromServer(NetConstant.GETRADIOLIST, params, isRefresh, this);
    }

    @Override
    public void onServerDataAcquired(int businessType, AsResult mAsResult, boolean isRefresh) {
        if (getBasePresenter() != null) {
            getBasePresenter().onServerDataAcquired(businessType, mAsResult, isRefresh);
        }
    }
}
